<?php
$color = array("", "red", "blue", "green");
$oddname = array(0 => "和", 1 => "<font color='#BB00AA'>单</font>", 2 => "<font color='#0077AA'>双</font>");
$bigname = array(0 => "和", 1 => "<font color='#BB00AA'>大</font>", 2 => "<font color='#0077AA'>小</font>", 3 => "<font color='chocolate'>中</font>");
$sxname = array("和",
"<font color='#BB00AA'>鼠</font>",
"<font color='#0077AA'>牛</font>",
"<font color='#BB00AA'>虎</font>", 
"<font color='#BB00AA'>兔</font>", 
"<font color='#BB00AA'>龍</font>", 
"<font color='#BB00AA'>蛇</font>",
"<font color='#0077AA'>馬</font>",
"<font color='#0077AA'>羊</font>", 
"<font color='#BB00AA'>猴</font>", 
"<font color='#0077AA'>雞</font>",
"<font color='#0077AA'>狗</font>", 
"<font color='#0077AA'>豬</font>");
function getsx($num)
{
	global $g_chinayearnum;
	foreach($g_chinayearnum as $key=>$val)
	{
		if(in_array(intval($num),$val)) return $key;	
	}	
	return 0;
}
$table='
<table  class="le_td3" width="235" border="0" cellpadding="0" cellspacing="0">
	<tr>
	  <td class="left_td3" height="25" width="25" align="center">期数</td>
	  <td class="left_td3" width="25" align="center">一</td>
	  <td class="left_td3" width="25" align="center">二</td>
	  <td class="left_td3" width="25" align="center">三</td>
	  <td class="left_td3" width="25" align="center">四</td>
	  <td class="left_td3" width="25" align="center">五</td>
	  <td class="left_td3" width="25" align="center">六</td>
	  <td class="left_td3" width="25" align="center">特</td>
	</tr>
<tbody>';
$table1=$table2=$table3=$table4="";
$rs = getdb("select n1,n2,n3,n4,n5,n6,spec,round,p1 from lotto where open<='".date('Y-m-d')."' and (n1+n2+n3+n4+n5+n6)>0 order by open desc limit 10");
while(!$rs->eof)
{
	$n1=sprintf("%02d",$rs->f["n1"]);
	$n2=sprintf("%02d",$rs->f["n2"]);
	$n3=sprintf("%02d",$rs->f["n3"]);
	$n4=sprintf("%02d",$rs->f["n4"]);
	$n5=sprintf("%02d",$rs->f["n5"]);
	$n6=sprintf("%02d",$rs->f["n6"]);
	$spec=sprintf("%02d",$rs->f["spec"]);

	$table1.='<tr class="row1" style="font-weight:bold">
				<td class="left_td3 co " width="25" align="center">'.d3($rs->f["round"]).'</td>
				<td class="left_td3" style="color:'.$color[$g_numcolor[$rs->f["n1"]]].'" width="25" align="center">'.$n1.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["n2"]]].'"  width="25" align="center">'.$n2.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["n3"]]].'"  width="25" align="center">'.$n3.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["n4"]]].'" width="25" align="center">'.$n4.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["n5"]]].'"  width="25" align="center">'.$n5.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["n6"]]].'" width="25" align="center">'.$n6.'</td>
				<td class="left_td3 " style="color:'.$color[$g_numcolor[$rs->f["spec"]]].'" width="25" align="center">'.$spec.'</td>
			  </tr>';
	$table2.='<tr class="row1">
				<td class="left_td3 co " width="25" align="center">'.d3($rs->f["round"]).'</td>
				<td class="left_td3"  width="25" align="center">'.$bigname[$rs->f['n1']==49?0:($rs->f['n1']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['n2']==49?0:($rs->f['n2']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['n3']==49?0:($rs->f['n3']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['n4']==49?0:($rs->f['n4']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['n5']==49?0:($rs->f['n5']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['n6']==49?0:($rs->f['n6']<=24?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$bigname[$rs->f['spec']==49?0:($rs->f['spec']<=24?2:1)].'</td>
			  </tr>';
	$table3.='<tr class="row1">
				<td class="left_td3 co " width="25" align="center">'.d3($rs->f["round"]).'</td>
				<td class="left_td3"  width="25" align="center">'.$oddname[$rs->f['n1']==49?0:($rs->f['n1']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['n2']==49?0:($rs->f['n2']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['n3']==49?0:($rs->f['n3']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['n4']==49?0:($rs->f['n4']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['n5']==49?0:($rs->f['n5']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['n6']==49?0:($rs->f['n6']%2==0?2:1)].'</td>
				<td class="left_td3 " width="25" align="center">'.$oddname[$rs->f['p1']].'</td>
			  </tr>';
	$table4.='<tr class="row1">
				<td class="left_td3 co " width="25" align="center">'.d3($rs->f["round"]).'</td>
				<td class="left_td3"  width="25" align="center">'.$sxname[getsx($rs->f['n1'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['n2'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['n3'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['n4'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['n5'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['n6'])].'</td>
				<td class="left_td3 " width="25" align="center">'.$sxname[getsx($rs->f['spec'])].'</td>
			  </tr>';
	$rs->movenext();
}
$rs->close();
$content='<div class="ShowOpen" id="ShowOpen_0">'.$table.$table1."</tbody></table></div>";
$content.='<div class="ShowOpen" id="ShowOpen_1" style="display:none">'.$table.$table2."</tbody></table></div>";
$content.='<div class="ShowOpen" id="ShowOpen_2" style="display:none">'.$table.$table3."</tbody></table></div>";
$content.='<div class="ShowOpen" id="ShowOpen_3" style="display:none">'.$table.$table4."</tbody></table></div>";
$table=$content;
?>